

using Abp.Domain.Repositories;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;

namespace Yozeev.BusinessLogic.DomainService
{
	/// <summary>
	/// Route领域层的业务管理
	///</summary>
	public class RouteManager :YozeevDomainServiceBase, IRouteManager
    {
		
		private readonly IRepository<Route,Guid> _repository;

		/// <summary>
		/// Route的构造方法
		///</summary>
		public RouteManager(
			IRepository<Route, Guid> repository
		)
		{
			_repository =  repository;
		}


		/// <summary>
		/// 初始化
		///</summary>
		public void InitRoute()
		{
			throw new NotImplementedException();
		}

		// TODO:编写领域业务代码

		public async Task<bool> RouteInsertAsync(List<Route> data)
		{
			if (data == null || data.Count == 0)
			{
				return true;
			}
			try
			{
				foreach (var entity in data)
				{
					await _repository.InsertAsync(entity);
				}
			}
			catch (Exception)
			{
				return false;
			}
			return true;
		}





	}
}
